<script setup lang="ts">
import { ref } from "vue";
import { formRules } from "./utils/rule";
import { FormProps } from "./utils/types";
import Motion from "@/views/login/utils/motion";

const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    id: "",
    keyword: "",
    remark: ""
  })
});

const ruleFormRef = ref();
const newFormInline = ref(props.formInline);

function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <el-form
    ref="ruleFormRef"
    :model="newFormInline"
    :rules="formRules"
    size="large"
  >
    <Motion>
      <el-form-item label="关键字" prop="keyword">
        <el-input
          v-model="newFormInline.keyword"
          clearable
          placeholder="请输入关键字"
        />
      </el-form-item>
    </Motion>
    <Motion>
      <el-form-item label="备注" prop="remark">
        <el-input
          type="textarea"
          v-model="newFormInline.remark"
          clearable
          placeholder="请输入备注"
        />
      </el-form-item>
    </Motion>
  </el-form>
</template>
